package com.c1.client.menu.item;

import javax.swing.*;
import java.awt.event.ActionListener;

public abstract class MItem {

    public abstract KeyStroke keyStroke();

    public abstract String showName();

    public abstract void process();

    public abstract boolean needCodePics();

    public JMenuItem get(ActionListener actionListener) {
        JMenuItem jMenuItem = new JMenuItem(showName());
        KeyStroke keyStroke = keyStroke();
        if (keyStroke != null) {
            jMenuItem.setAccelerator(keyStroke);
        }
        jMenuItem.addActionListener(actionListener);
        return jMenuItem;
    }
}
